/**
 * meiguang8.com
 * Copyright (C) 2016-2019 All Rights Reserved.
 */
package com.yuanchuang.yp.mall.web.admin.controller.user;

import com.yuanchuang.yp.framework.common.CommonResult;
import com.yuanchuang.yp.mall.web.admin.controller.BaseController;
import com.yuanchuang.yp.mall.web.admin.entity.AuthUserDO;
import com.yuanchuang.yp.mall.web.admin.user.model.UserModel;
import com.yuanchuang.yp.mall.web.admin.user.service.IAuthUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * class_name: UserController
 * package: com.yuanchuang.yp.mall.web.admin.controller
 * describe: TODO
 * @author: yuanyuan.zhu
 * creat_date: 2019/7/10
 * creat_time: 21:22
 **/
@RestController
@RequestMapping("/user")
@Api(tags = "用户接口")
public class UserController extends BaseController {
    @Autowired
    private HttpServletRequest request;
    @Autowired
    private IAuthUserService iAuthUserService;
    @GetMapping("/info")
    @ApiOperation( value = "获取用户信息")
    public CommonResult getUserInfo(){
        // 获取用户Id
        AuthUserDO authUser = getAuthUser(request);
        UserModel authUserInfo = iAuthUserService.getAuthUserInfo(authUser.getId());
        return CommonResult.ok(authUserInfo);
    }


}
